#include "DialogMinMaxArea.h"
#include "MainFrame.h"

DialogMinMaxArea::DialogMinMaxArea( wxWindow* parent )
:
DialogMinMaxTemplate( parent )
{

}

void DialogMinMaxArea::OnNewValueMin( wxSpinEvent& event )
{
	MainFrame* parent = (MainFrame*)this->GetParent();
	
	parent->setMinArea(spinCtrlMin->GetValue());
}

void DialogMinMaxArea::OnNewValueMax( wxSpinEvent& event )
{
	MainFrame* parent = (MainFrame*)this->GetParent();
	
	parent->setMaxArea(spinCtrlMax->GetValue());
}

void DialogMinMaxArea::updateAreas()
{
	MainFrame* parent = (MainFrame*)this->GetParent();
	
	int minArea = parent->getMinArea();
	int maxArea = parent->getMaxArea();
	
	spinCtrlMin->SetValue(minArea);
	spinCtrlMax->SetValue(maxArea);
	
	
}

void DialogMinMaxArea::setMaxVal(int area)
{
	spinCtrlMax->SetValue(area);
}
